#pragma once
#include "../Hchassis/Hchassis.h"
#define USE_ControllerEnhanced true //是否使用加强遥控器

#if USE_ControllerEnhanced
#include "_my_ctrl.h"
extern ControllerEnhanced ctrl; //全局加强遥控器声明
#else
extern vex::controller ctrl; //全局遥控器声明
#endif

///////////////////////////////////////////////////////////////
using signature = vision::signature;
using code = vision::code;
// vision
extern signature vis_BLUE;
extern signature vis_RED;
extern signature vis_GREEN;
extern signature vis_YELLOW;
extern vision vis;
////////////////////////////////////////////////////////////////////////
//马达和传感器声明
extern vex::motor mtr_LF;
extern vex::motor mtr_LB;
extern vex::motor mtr_LF1;
extern vex::motor mtr_LB1;
extern vex::motor mtr_RF;
extern vex::motor mtr_RB;
extern vex::motor mtr_RF1;
extern vex::motor mtr_RB1;

extern vex::motor mtr_suck;
extern vex::motor mtr_chain;
extern vex::motor mtr_arml;
extern vex::motor mtr_armr;



//动作单元声明
extern ActionUnit chassis_l;
extern ActionUnit chassis_r;
extern Hchassis chassis;
extern ActionUnit chain;
extern ActionUnit suck;
extern ActionUnit arm;


extern Solenoid_Driver clamp;
extern Solenoid_Driver hanger;
extern Solenoid_Driver sucklock;

//陀螺仪声明
extern vex::inertial imu;

//其他传感器声明
extern rotation enc_punch;
extern vex::distance dis;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*
自动程序路线信息
*/
//千万不要修改下面数值定义！！！
#define Alliance_RED -1
#define Alliance_BLUE 1
#define SIDE_LEFT 1
#define SIDE_RIGHT 2

#define SIDE_LEFT_MAX_AUTO_NUMBER 6
#define SIDE_RIGHT_MAX_AUTO_NUMBER 6

class AutoInfo {
public:
  enum class Alliance {
    red = Alliance_RED,
    blue = Alliance_BLUE,
  };
  enum class Side {
    left = SIDE_LEFT,
    right = SIDE_RIGHT,
  };

  Alliance alliance; ///红蓝联队
  Side side;         ///左右位置
  int route_number;  ///线路号
  AutoInfo(Alliance s, Side r, int n) : alliance(s), side(r), route_number(n) {}

  bool isAlliance(Alliance a) { return a == alliance; }
  bool isSide(Side s) { return s == side; }
  int alliance_dir() { return (alliance == Alliance::red) ? -1 : 1; }
  int side_dir() { return (side == Side::left) ? -1 : 1; }
};

using Alliance = AutoInfo::Alliance;
using Side = AutoInfo::Side;

extern AutoInfo auto_info;
////////////////////////////////////////////////////////////////////////
extern thread thread_autonomous;
extern bool autonomous_running;
////////////////////////////////////////////////////////////////////////
